const KoaRouter = require('@koa/router')
const userController = require('../controller/user.controller')
const { verifUser, handlePassword } = require('../middleware/user.middleware')
// 1.创建路由对象

const userRouter = new KoaRouter({ prefix: '/users' })

// 2.定义路由映射
// 用户注册接口
userRouter.post('/', verifUser, handlePassword, userController.create)
// 为用户提供头像
userRouter.get('/avatar/:userId', userController.showAvatarImage)
// 3.导出路由
module.exports = userRouter